﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using TerminationCall.Core;

namespace TerminationCall.Editor.Logic
{
    public class EditorTool
    {
        private PaintToolSet _paintToolSet;
        private Level _level;

        public event EventHandler<EventArgs> LevelChanged;

        public EditorTool()
        {
            _paintToolSet = new PaintToolSet(this);
            _level = new Level();
            
            _level.Background = new Bitmap(Image.FromFile("Background.png"));
            _level.Layers.Add(new Layer(500));
        }

        public Rectangle ChoosenTiles { get; set; }
        public TileSet ChoosenTileSet { get; set; }
        public Point Offset { get; set; }
        public TileObjectGroup ChoosenTileObjectGroup { get; set; }

        public Layer ChoosenLayer {
            get {
                return _level.Layers[0];
            }
        }
                
        public Level Level
        {
            get
            {
                return _level;
            }
            set {
                _level = value;

                if (LevelChanged != null) {
                    LevelChanged(this, EventArgs.Empty);
                }
            }
        }

        public PaintToolSet PaintToolSet {
            get {
                return _paintToolSet;
            }
        }
    }
}
